<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/8/24 0024
  Time: 10:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path = request.getContextPath();%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<script src="<%=path%>/static/js/jquery-3.5.1.min.js"></script>
<style>
    table tr img{
        width: 50px;
        height: 50px;
    }
    table tr{
        text-align: center;
    }
</style>
<script>
    $(function () {
        $("a[class=link-del]").click(function () {
           var id = $(this).attr("id");
           $.get("<%=path%>/manage/address/delProvince",{id:id},function () {
                $(this).parent().parent().remove();
           }.bind(this));
           return false;
        });
    });
</script>
<table class="result-tab" width="100%">
    <tr>
        <th>ID</th>
        <th>名称</th>
        <th>添加时间</th>
        <th>修改时间</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${requestScope.provincePageInfo.list}" var="province">
        <tr id="${province.id}" class="rows">
            <td>${province.id}</td>
            <td>${province.provinceName}</td>
            <td><fmt:formatDate value="${province.dateCreated}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
            <td>
                <c:if test="${empty province.dateUpdated}">
                    无修改
                </c:if>
                <fmt:formatDate value="${province.dateUpdated}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
            </td>
            <td>
                <a class="link-find" href="<%=path%>/manage/address/city?id=${province.id}">查看</a>
                <a class="link-update" href="#" id="${province.id}">修改</a>
                <a class="link-del" href="#" id="${province.id}">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
<div class="list-page">
    ${requestScope.provincePageInfo.pages}页
    <a href="#" data-pagenum="1">首页 </a>
    <c:if test="${requestScope.provincePageInfo.pageNum gt 1}">
        <a href="#" data-pagenum="${requestScope.provincePageInfo.pageNum-1}">上一页</a>
    </c:if>

    <c:forEach begin="1" end="${requestScope.provincePageInfo.pages}" var="i">

        <a href="#" data-pagenum="${i}"
                <c:if test="${i eq requestScope.provincePageInfo.pageNum}"> class="current" </c:if>>${i}</a>
    </c:forEach>

    <c:if test="${requestScope.provincePageInfo.pageNum lt requestScope.provincePageInfo.pages}">
        <a href="#" data-pagenum="${requestScope.provincePageInfo.pageNum+1}">下一页</a>
    </c:if>
    <a href="#" data-pagenum="${requestScope.provincePageInfo.pages}">尾页 </a>
    ${requestScope.provincePageInfo.pageNum}/${requestScope.provincePageInfo.pages}页
</div>

